package cn.xspace.library.bean;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.xspace.android.xafcommon.been.AppIndexInfo;
import com.xspace.android.xafcommon.been.AppInfoBean;
import com.xspace.android.xafcommon.been.UserAuthorityBean;
import com.xspace.android.xafcommon.been.UserInfoBean;

import java.util.HashMap;

/**
 * Created by liuchen on 2016/11/30.
 */

@XStreamAlias("Build")
public class BuildBean {

    @XStreamAlias("AppConfig")
    public AppInfoBean appInfo;

    public AppIndexInfo appIndexInfo;

    public UserInfoBean userInfoBean;

    @XStreamAlias("welcomePage")
    public WelcomePageBean welcomePage;

    @XStreamAlias("guidePage")
    public GuidePageBean guidePageBean;

    @XStreamAlias("navigation")
    public  NavigationBean navigationBean  ;

    public HashMap<String, UserAuthorityBean> authorityMap = new HashMap<>();

    @Override
    public String toString() {
        return "BuildBean{" +
                "appInfo=" + appInfo +
                ", welcomePage=" + welcomePage +
                ", guidePageBean=" + guidePageBean +
                ", navigationBean =" + navigationBean +
                '}';
    }

//    public static BuildBean parseBuildConfigBean(InputStream inStream) {
//        BuildBean bean = XmlUtils.toBean(BuildBean.class, inStream);
//        bean.appIndexInfo = new AppIndexInfo();
//        bean.userInfoBean = new UserInfoBean();
//        L.v(bean.toString());
//        return bean;
//    }

    public void cleanData() {
        appIndexInfo = null;
        appIndexInfo = new AppIndexInfo();
        userInfoBean = null;
        userInfoBean = new UserInfoBean();
        authorityMap.clear();
    }
}
